package com.skt.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.skt.entity.Image;
import com.skt.vo.ImageQuery;

@Controller  
@RequestMapping(value = "/HelloWorld")  
public class HelloWorld {  
	
    @RequestMapping(value = "Hello")  
    public ModelAndView SayHello(ImageQuery query) {   
        ModelAndView result = new ModelAndView("HelloWorld");
        List<String> selector = new ArrayList<String>();
        selector.add("1");
        selector.add("2");
        result.addObject("selectorList", selector);
        result.addObject("selectorQuery", query);
        return result;
    }  
    
    @RequestMapping(value = "query")  
    public ModelAndView query(ImageQuery query) {   
        ModelAndView result = new ModelAndView("HelloWorld");
        List<String> selector = new ArrayList<String>();
        selector.add("1");
        selector.add("2");
        result.addObject("selectorList", selector);
        result.addObject("selectorQuery", query);
        
        Image image = new Image();
        image.setName(query.getName());
        image.setSelector(query.getSelector());
        image.setImageLocation("http://photocdn.sohu.com/20170310/Img482880278.jpeg");
        result.addObject("image", image);
        return result;
    }  
}  
